package com.zeng.swaggerdemo.controller;

import com.zeng.swaggerdemo.pojo.User;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @GetMapping("/hello")
    public String Holle() {
        return "hello world";
    }

    @PostMapping("/zeng/hello")
    public String zeng() {
        return "hello world";
    }

    @PostMapping("/getUser")
    public User getUser() {//空的可以存在
        return new User();
    }
    @ApiOperation("狂神说")
    @PostMapping("/kuang")
    public String kuang(@ApiParam("这个名字被返回") String username){
        return "hello"+username;
    }
    @ApiOperation("post测试")
    @PostMapping(value = "/postt")
    public User postt(@ApiParam("用户名")User user){
        return user;
    }
    // 500
    @ApiOperation("post测试")
    @PostMapping("/kuang")
    public String postt(@ApiParam("用户名") String username){
        int i = 5/0;
        return "hello"+username;
    }
}
